Skip to content

Conversation

salmany
Copy link
Contributor

@salmany salmany commented Jul 29, 2025

Note: This PR builds on top of the work in PR #13515 and should not be merged until that one is complete. The "Files changed" tab currently includes changes from the dependency.

This commit adds examples for creating Managed Kafka Connect connectors:

  • MirrorMaker connector
  • BigQuery sink connector
  • Cloud Storage sink connector
  • Pub/Sub sink connector
  • Pub/Sub source connector

Description

Fixes https://b.corp.google.com/issues/430087669

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

salmany and others added 11 commits July 24, 2025 00:36
clusters

* Adds code examples for creating, deleting,
getting, listing and updating Managed Kafka
Connect clusters
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit adds examples for creating
Managed Kafka Connect connectors:
* MirrorMaker connector
* BigQuery sink connector
* Cloud Storage sink connector
* Pub/Sub sink connector
* Pub/Sub source connector
@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Jul 29, 2025
Copy link
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

@salmany salmany changed the title Mkc-connectors-examples Add Managed Kafka Connect Connectors Examples Jul 29, 2025
@salmany salmany marked this pull request as ready for review July 29, 2025 00:51
@salmany salmany requested review from a team as code owners July 29, 2025 00:51
Copy link

snippet-bot bot commented Jul 29, 2025

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@glasnt glasnt added kokoro:force-run Add this label to force Kokoro to re-run the tests. kokoro:run Add this label to force Kokoro to re-run the tests. labels Aug 25, 2025
@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Aug 25, 2025
@glasnt glasnt added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@glasnt glasnt added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@glasnt glasnt self-assigned this Aug 25, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@glasnt
Copy link
Contributor

glasnt commented Aug 25, 2025

It looks like the linting here is failing because both the managedkafka/snippets and managedkafka/snippets/connect/connectors have requirements.txt files, which causes linting to run in both locations

Google linting style requires that imports from local files are grouped separately. But when the linting is running from a parent folder, it doesn't see those local files, so the lint from the parent folder fails due to child folder local imports.

It looks like #13515 also introduced a new requirements.txt file, so there's no longer just one requirements file for the whole snippets folder.

Since this PR adds a requirements.txt file that duplicates the parent requirements.txt, I'm going to remove it from this PR. This will mean:

  1. changes to this folder will cause the whole managedkafka/snippets sample collection to be tested, which might cause future issues with changes causing unrelated tests to fire

  2. the imports for the test file will conform to parent linting, but look potentially "out of order"

@glasnt glasnt added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 25, 2025
@glasnt glasnt requested a review from rQ-Qrr August 25, 2025 02:23
@glasnt glasnt added the waiting-response Waiting for the author's response. label Aug 25, 2025
@salmany
Copy link
Contributor Author

salmany commented Sep 4, 2025

Re: the requirements.txt file, I had added it in the 'connectors' directory for running the tests locally, and was unsure if it was required to be submitted. Thanks for sorting it out!

@glasnt glasnt added kokoro:force-run Add this label to force Kokoro to re-run the tests. and removed waiting-response Waiting for the author's response. labels Sep 4, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 4, 2025
@glasnt glasnt added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 4, 2025
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 4, 2025
@glasnt glasnt merged commit 5426f61 into GoogleCloudPlatform:main Sep 4, 2025
11 checks passed
# connect_cluster_id = "my-connect-cluster"
# connector_id = "CPS_SINK_CONNECTOR_ID"
# topics = "GMK_TOPIC_ID"
# value_converter = "org.apache.kafka.connect.storage.StringConverter"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the default converter for CPS sink connector is org.apache.kafka.connect.converters.ByteArrayConverter on UI. Could you check it? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has already been merged. If you feel there are further changes needed, please create a new PR. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #13527 (comment)

"target.cluster.alias": target_cluster_alias, # This is usually the primary cluster.
# Replicate all topics from the source
"topics": topics,
# The value for bootstrap.servers is a comma-separated list of hostname:port pairs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I'm not quite sure if we could do that. I never tried to configure a comma-separated list for the source or target servers but only a single server address. Could you double check?
  2. It would be better if adding an example of the server address format in the comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #13527 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants